<admintpl file="header" />
</head>
<body>
    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <if condition="$admin['role_id'] lt 20 ">
                <li><a href="{:U('Analysis/index')}">数据汇总</a></li>
                <li><a href="{:U('Analysis/day')}">单日统计</a></li>
                <li><a href="{:U('Analysis/activity')}">活动统计</a></li>
            </if>
            <li><a href="{:U('Analysis/materials')}">物料统计</a></li>
            <if condition="$admin['role_id'] lt 20 ">
                <li><a href="{:U('Analysis/equipment')}">设备统计</a></li>
                <li><a href="{:U('Analysis/users')}">用户统计</a></li>
            </if>
            <li class="active"><a href="{:U('Analysis/winning')}">中奖记录</a></li>
            <if condition="$admin['role_id'] lt 20 ">
                <li><a href="{:U('Analysis/withdraw')}">提现记录</a></li>
                <li><a href="{:U('Analysis/logs')}">摇摇记录</a></li>
                <li><a href="{:U('Analysis/urls')}">链接记录</a></li>
            </if>
        </ul>
        <form class="well form-search js-ajax-form" method="post" action="{:U('Analysis/winning')}">

            商家类型：
            <select name="bstype" style="width: 100px;">
                <foreach name="btypes" item="vo">
                    <option <if condition="(I('param.bstype') eq $vo['id'])" >selected</if> value="{$vo.id}">{$vo.name}</option>
                </foreach>
            </select>
            物料类型：
            <select name="bctype" style="width: 100px;">
                    <option <if condition="(I('param.bctype') eq $vo['id'])" >selected</if> value="0">请选择</option>
                <foreach name="card_type" item="vo">
                    <option <if condition="(I('param.bctype') eq $vo['id'])" >selected</if> value="{$vo.id}">{$vo.name}</option>
                </foreach>
            </select>
            查询类型：
            <select name="search" style="width: 100px;">
                <foreach name="search" item="vo">
                    <option <if condition="(I('param.search') eq $vo['id'])" >selected</if> value="{$vo.id}">{$vo.name}</option>
                </foreach>
            </select>
            查询内容：
            <input type="text" name="keyword" style="width: 100px;" value="{:I('param.keyword')}" placeholder="请输入查询内容...">
            时间范围：
            <input type="text" name="start_time" class="js-datetime" value="{:I('param.start_time')}" style="width: 80px;" autocomplete="off"> ~
            <input type="text" name="end_time" class="js-datetime"  value="{:I('param.end_time')}" style="width: 80px;" autocomplete="off">

            <input type="submit" class="btn btn-primary" value="搜索" />
            <if condition="$count" >共查询到 {$count} 条数据</if>
        	<button class="btn btn-primary js-ajax-submit" type="submit" data-action="{:U('Analysis/outwinningcsv')}">查询导出</button>

        </form>
            <table class="table table-hover table-bordered">
                <thead>
                    <tr>
                    	<th>日期/设备ID</th>
                        <th>店铺名称 - 类型</th>
                        <th>店铺地址/省市区</th>
                        <th>用户ID/用户昵称</th>
                        <th>活动名称-类型/物料名称-类型</th>
                        <th>中奖金额 (元)- 卡券编号/流水号</th>
                    </tr>
                </thead>
                <foreach name="analysis" item="vo">
                    <tr>
                        <td>{$vo.datetime}<br>{$vo.devid}</td>
                        <td>{$vo.bsname} -
                        	<foreach name="btypes" item="bts">
								<if condition="$bts['id'] eq $vo['bstype']" >{$bts.name}</if>
                        	</foreach>
                        </td>
                        <td>{$vo.bsaddress}<br>
                        	<foreach name="region" item="pid">
								<if condition="$pid['code'] eq $vo['province_id']" >{$pid.name} - </if>
								<if condition="$pid['code'] eq $vo['city_id']" >{$pid.name}</if>
								<if condition="$pid['code'] eq $vo['district_id']" > - {$pid.name}</if>
                        	</foreach></td>
                        <td>{$vo.openid}<br>
                        <foreach name="realuser" item="user">
							<if condition="$user['weixin_id'] eq $vo['openid']" > {$user.nickname}</if>
						</foreach></td>
                        <td>{$vo.ename} - <if condition="$vo['etype'] eq 1" >摇一摇<else />扫一扫</if><br>{$vo.cname} - {$card_type[$vo['ctype']-1]['name']}</td>
                        <td>{$vo['moneys']/100} - {$vo.cardnum}<br>{$vo.sn}</td>
                    </tr>
                </foreach>
                <thead>
                    <tr>
                    	<th>日期/设备ID</th>
                        <th>店铺名称 - 类型</th>
                        <th>店铺地址/省市区</th>
                        <th>用户ID/用户昵称</th>
                        <th>活动名称-类型/物料名称-类型</th>
                        <th>中奖金额 (元) - 卡券编号/流水号</th>
                    </tr>
                </thead>
            </table>
            <div class="pagination">{$page}</div>
    </div>
    <script src="__PUBLIC__/js/common.js"></script>
</body>
</html>